#pragma once

#include <QPointF>
#include <QObject>

#include "src/QNeuronWindow/QNerveTissue.h"

class QNode: public QObject
{
    Q_OBJECT
private:
    QList<QNerveTissue*> nerveList;

    QPointF pos, posDot;
    double fx, fy;
    double w, h;

    double dt;

    bool fixed;
    int id;

protected:

public:
    QNode(void);

    QPointF getPos(void);
    QPointF getPosDot(void);

    int getID(void);

    void calcMemPot(void);
    double getMemPot(int channel);

    bool isFixed(void);

    void rotate(void);

    QList<QNerveTissue*> getNerveList(void);
    QList<int> getSenderList(void);

public slots:
    void addXForce(double _fx);
    void addYForce(double _fy);
    void setPos(QPointF _pos);
    void setPosDot(QPointF _posDot);
    void setFixed(bool _fixed);
    void setID(int _id);
    void setDT(double _dt);

    void setAllowedSize(double _w, double _h);

    void addNerve(QNerveTissue* _nerve);
    void setNerveList(QList<QNerveTissue*> _nerveList);

signals:
    void idChanged(int);
    void fixedStateChanged(bool);
    void DTChanged(double);
    void posDotXChanged(double);
    void posDotYChanged(double);
    void posXChanged(double);
    void posYChanged(double);
    void nerveListChanged(int);

};
